﻿using MediatR;
using S.EarTag.API.Application.MediatorCommand.ProductionGradingCommand;
using S.EarTag.Infrastructure.Repository.Interface.IRepository;

namespace S.EarTag.API.Application.MediatorCommandHandler.ProductionGradingCommandHandler
{
    public class ProductionGradingRemoveCommandHandler : IRequestHandler<ProductionGradingRemoveCommand, bool>
    {
        private readonly IProductionGradingRepository _productionGradingRepository;
        public ProductionGradingRemoveCommandHandler(IProductionGradingRepository productionGradingRepository)
        {
            _productionGradingRepository = productionGradingRepository;
        }
        /// <summary>
        /// 根据生产定级主键Id进行单删
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<bool> Handle(ProductionGradingRemoveCommand request, CancellationToken cancellationToken)
        {
            return await _productionGradingRepository.DeleteAsync(request.ProductionGradingId);
        }
    }
}
